﻿<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title>超市账单管理系统</title>
    <link rel="stylesheet" href="static/css/public.css"/>
    <link rel="stylesheet" href="static/css/style.css"/>
    <script  src="static/detail/style/js/jquery.js"></script>
    <script  src="static/detail/style/js/page_common.js"></script>
    <script>
        var url = document.location.href;
        var urlList = url.split('=');//“=”代表你拿哪个标点符号后的值例如：“/”“？”
        var a = urlList[urlList.length-1].split('.')[0];
        $(function (){
            var b = "";
            $.ajax({
                type: 'post',
                url:  '/user/edit',
                dataType:"json",
                async:false,
                data:{id:a},
                success: function (res) {
                    $("#id").val(res.id);
                    $("#name").val(res.name);
                    $("#password").val(res.password);
                    $("#sex").val(res.sex);
                    $("#age").val(res.age);
                    $("#phone").val(res.phone);
                    $("#address").val(res.address);
                    $("#usertype").val(res.usertype);
                }
            });
        })
        function sub(){
            $.ajax({
                type: 'post',
                url:  '/user/update',
                data: $("#form").serialize(),
                success:function (){
                    window.location.href="userList.html";
                }
            });
        }
    </script>
</head>
<body>
<!--头部-->
<header class="publicHeader">
    <h1>超市账单管理系统</h1>

    <div class="publicHeaderR">
        <p><span>下午好！</span><span style="color: #fff21b"> Admin</span> , 欢迎你！</p>
        <a href="login.html">退出</a>
    </div>
</header>
<!--时间-->
<section class="publicTime">
    <span id="time">2015年1月1日 11:11  星期一</span>
    <a href="#">温馨提示：为了能正常浏览，请使用高版本浏览器！（IE10+）</a>
</section>
<!--主体内容-->
<section class="publicMian ">
    <div class="left">
        <h2 class="leftH2"><span class="span1"></span>功能列表 <span></span></h2>
        <nav>
            <ul class="list">
                <li><a href="billList.html">账单管理</a></li>
                <li ><a href="providerList.html">供应商管理</a></li>
                <li id="active"><a href="userList.html">用户管理</a></li>
                <li><a href="password.html">密码修改</a></li>
                <li><a href="login.html">退出系统</a></li>
            </ul>
        </nav>
    </div>
    <div class="right">
        <div class="location">
            <strong>你现在所在的位置是:</strong>
            <span>用户管理页面 >> 用户修改页面</span>
        </div>
        <div class="providerAdd">
            <form id="form">
                <!--div的class 为error是验证错误，ok是验证成功-->
                <input id="id" name="id" type="hidden"/>
                <div>
                    <label for="name">用户名称：</label>
                    <input type="text" name="name" id="name" />
                    <span >*</span>
                </div>
                <div>
                    <label for="password">用户密码：</label>
                    <input type="text" name="password" id="password" />
                    <span >*</span>
                </div>
                <div>
                    <label for="sex">用户性别：</label>
                    <input type="text" name="sex" id="sex" />
                    <span >*</span>
                </div>
                <div>
                    <label for="age">年龄：</label>
                    <input type="text" name="age" id="age" />
                    <span >*</span>
                </div>
                <div>
                    <label for="phone">用户电话：</label>
                    <input type="text" name="phone" id="phone" />
                    <span >*</span>
                </div>
                <div>
                    <label for="address">用户地址：</label>
                    <input type="text" name="address" id="address" />
                </div>
                <div>
                    <label >用户类别：</label>
                    <input type="radio" name="usertype" value="管理员"/>管理员
                    <input type="radio" name="usertype" value="经理" />经理
                    <input type="radio" name="usertype" value="保洁" />保洁
                    <input type="radio" name="usertype" value="普通用户"/>普通用户
                </div>

            </form>
            <div class="providerAddBtn">
                <!--<a href="#">保存</a>-->
                <!--<a href="userList.html">返回</a>-->
                <input type="button" value="保存" onclick="sub()"/>
                <input type="button" value="返回" onclick="history.back(-1)"/>
            </div>
        </div>

    </div>
</section>
<footer class="footer">
</footer>
<script src="static/js/time.js"></script>

</body>
</html>